//logs.js
const util = require('../../utils/util.js')

Page({
      data: {
        logs: []
      },
      tiaozuan() {
        wx.navigateTo({
              url: '/pages/content/content'
            })
          },
          btn: function() {

            wx.getSetting({
              success(res) {
                if (!res.authSetting['scope.record']) {
                  wx.authorize({
                    scope: 'scope.record',
                    success() {
                      // 用户已经同意小程序使用录音功能，后续调用 wx.startRecord 接口不会弹窗询问
                      wx.startRecord()
                    }
                  })
                }
              }
            })

          },
          onLoad: function() {
            this.setData({
              logs: (wx.getStorageSync('logs') || []).map(log => {
                return util.formatTime(new Date(log))
              })
            })
          }
      })